<!DOCTYPE HTML>
<html xmlns:wb="http://open.weibo.com/wb">
<head>
	<script id="allmobilize" charset="utf-8" src="style/js/allmobilize.min.js"></script>
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<link rel="alternate" media="handheld"  />
	<!-- end 云适配 -->
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>注册-xx网-最专业的互联网招聘平台</title>
	<meta property="qc:admins" content="23635710066417756375" />
	<meta content="xx网是3W旗下的互联网领域垂直招聘网站,互联网职业机会尽在xx网" name="description">
	<meta content="xx,xx网,xx招聘,牛币, 牛币网 ,互联网招聘,xx互联网招聘, 移动互联网招聘, 垂直互联网招聘, 微信招聘, 微博招聘, xx官网, xx百科,跳槽, 高薪职位, 互联网圈子, IT招聘, 职场招聘, 猎头招聘,O2O招聘, LBS招聘, 社交招聘, 校园招聘, 校招,社会招聘,社招" name="keywords">

	<meta name="baidu-site-verification" content="QIQ6KC1oZ6" />

	<!-- <div class="web_root"  style="display:none">h</div> -->
	<script type="text/javascript">
		var ctx = "h";
		console.log(1);
	</script>
	<link rel="Shortcut Icon" href="h/images/favicon.ico">
	<link rel="stylesheet" type="text/css" href="style/css/style.css"/>

	<script src="style/js/jquery.1.10.1.min.js" type="text/javascript"></script>

	<script type="text/javascript" src="style/js/jquery.lib.min.js"></script>
	<script type="text/javascript" src="style/js/core.min.js"></script>
	

	<script type="text/javascript">
		var youdao_conv_id = 271546;
	</script>
	<script type="text/javascript" src="style/js/conv.js"></script>
</head>

<body id="login_bg">
<div class="login_wrapper">
	<div class="login_header">
		<a href="h/"><img src="style/images/logo_white.png" width="285" height="62" alt="xx招聘" /></a>
		<div id="cloud_s"><img src="style/images/cloud_s.png" width="81" height="52" alt="cloud" /></div>
		<div id="cloud_m"><img src="style/images/cloud_m.png" width="136" height="95"  alt="cloud" /></div>
	</div>

	<input type="hidden" id="resubmitToken" value="9b207beb1e014a93bc852b7ba450db27" />
	<div class="login_box">
		<form id="loginForm" >
			<ul class="register_radio clearfix">
				<li>
					找工作
					<input type="radio" value="0" name="type" />
				</li>
				<li>
					招人
					<input type="radio" value="1" name="type" />
				</li>
			</ul>
			<input type="text" id="email" name="email" tabindex="1" placeholder="请输入常用邮箱地址" />
			<span class="error" style="display:none;" id="beError"></span>
			<span class="error" id="emailErrorCode"></span>
			<input type="password" id="password" name="password" tabindex="2" placeholder="请输入密码" />
			<!--<div style="display: inline-block" id = "tt" name="tt">
				<input type="text" name="verfycode" style="width:100px;font-size:16px; color:#777; border:none;" placeholder="请输入验证码" /><img id = "image"th:src="@{/verifyCode}" style="margin-bottom: -11px;margin-left: 2px;">
				<a href="#" style="width: 80px;background-color: #0D9572;border: none;text-align: center;color: white;font-size:16px;" id = "btn">换一张</a>
			</div>-->
			<div style="display: inline-block" id = "tt" name="tt">
				<input type="text" id = "verifycode" name="verifycode" style="width:150px;font-size:16px; color:#777; border:none;" placeholder="请输入邮箱验证码" />
				<a href="#" style="width: 80px;background-color: #0D9572;border: none;text-align: center;color: white;font-size:16px;padding: 5px;" id = "btn">发送验证码</a>
			</div>
			<input type="text" id = "codeStatue" name="codeStatue" style="display: none;width:150px;font-size:16px; color:#777; border:none;" placeholder="请输入邮箱验证码" />
			<span class="error" style="display:none;" id="codeError"></span>
			<span class="error" id="codeStatueError"></span>
			<label class="fl registerJianJu" for="checkbox">
				<input type="checkbox" id="checkbox" name="checkbox" checked  class="checkbox valid" />我已阅读并同意<a href="h/privacy.html" target="_blank">《xx用户协议》</a>
			</label>
			<input type="submit" id="submitLogin" value="注 &nbsp; &nbsp; 册" />
			<a href="login.html" class="fr" style="display: block;height: 60px;line-height: 60px;">去登录</a>
			<p style="margin-top: 100px;" id="registerState"></p>
			<input type="hidden" id="callback" name="callback" value=""/>
			<input type="hidden" id="authType" name="authType" value=""/>
			<input type="hidden" id="signature" name="signature" value=""/>
			<input type="hidden" id="timestamp" name="timestamp" value=""/>
			
		</form>

	</div>
	<div class="login_box_btm" style=""></div>

</div>
<script type="text/javascript" src="style/js/myajax.js"></script>
<script type="text/javascript">

	$(document).ready(function(e) {
		$('.register_radio li input').click(function(e){
			$(this).parent('li').addClass('current').append('<em></em>').siblings().removeClass('current').find('em').remove();
		});

		$('#email').focus(function(){
			$('#beError').hide();
		});
		//验证表单
		$("#loginForm").validate({
			debug: true,
			rules: {
				type:{
					required: true
				},
				codeStatue:{
					required: true
				},
				email: {
					required: true,
					email: true
				},
				password: {
					required: true,
					rangelength: [6,16]
				},
				checkbox:{required:true}
			},
			messages: {
				type:{
					required:"请选择使用xx的目的"
					
				},
				email: {
					required: "请输入常用邮箱地址",
					email: "请输入有效的邮箱地址，如：vivi@lagou.com"
					
				},
				password: {
					required: "请输入密码",
					rangelength: "请输入6-16位密码，字母区分大小写"
					
				},
				checkbox: {
					required: "请接受xx用户协议"
				},
				codeStatue: {
					required: "请输入验证码"
				}
			},
			errorPlacement:function(label, element){/*
			    		if(element.attr("type") == "radio"){
			    			label.insertAfter($(element).parents('ul')).css('marginTop','-20px');
			    		}else if(element.attr("type") == "checkbox"){
			    			label.inserresult.contenttAfter($(element).parent()).css('clear','left');
			    		}else{
			    			label.insertAfter(element);
			    		} */
				/*modify nancy*/
				if(element.attr("type") == "radio"){
					label.insertAfter($(element).parents('ul')).css('marginTop','-20px');
				}else if(element.attr("type") == "checkbox"){
					label.insertAfter($(element).parent()).css('clear','left');
				}else{
					label.insertAfter(element);
				};
			},
			submitHandler: function(form){
				
				var state = ajaxPost("#loginForm", "/user/register")
				if(state.msg != undefined){
					$('#emailErrorCode').css("display", "block").html(state.msg)
					$('#codeStatueError').css("display", "none")
					$('#registerState').html("")
				}
				if(state.codeMsg != undefined){
					$('#codeStatueError').css("display", "block").html(state.codeMsg)
					$('#emailErrorCode').css("display", "none")
					$('#registerState').html("")
				}
				if(state.requestCode != undefined){
					$('#registerState').html("注册成功去<a href='login.html'>登录</a>")
					$('#emailErrorCode').css("display", "none")
					$('#codeStatueError').css("display", "none")
				}
				
				
			},

		});
	


	$('#btn').on('click',function(){
		var email = $('#email').val()
		$('#emailErrorCode').css("display", "none")
		$('#codeStatueError').css("display", "none")
		//发送邮箱验证码
		$.ajax({
			url: "http://127.0.0.1:8081/recruit/sendEmailVerifyCode",
			data: {email: email},
			crossDomain: true,
			xhrFields: {
				withCredentials: true
			},
			type: "get",
			dataType: "json",
			success: function(data) { //判断返回的数据
				// data = jQuery.parseJSON(data);  //dataType指明了返回数据为json类型，故不需要再反序列化
				var msg = data.msg
				if(data.msg == 1){
					$('#beError').css('display','block').html("该帐号已被注册")
				}else{
					$('#beError').css('display','none')
					var i = 60;
					//设置定时器（循环去执行）
					var timeId = setInterval(function () { 

						$('#btn').html("重新发送验证码("+i+"秒后)").css({"background-color": '#9f9f9f', "pointer-events": "none"})
						i--
						if(i == -1){

							$('#btn').html("发送验证码").css({"background-color": '#0D9572',"pointer-events":"auto"})
							window.clearInterval(timeId)
						}

					}, 1000)
				}
			}
		});
	});

	$("#verifycode").on('blur',function(){
		//alert("失去焦点")
		//console.log("失去焦点")
		$('#codeStatue').val($("#verifycode").val())
	})

// 	$('#submitLogin').on("click", function(){
// 		alert("132")
//  		var state = ajaxPost("#loginForm", "/user/register")
// 		alert(state)
// // 		if(state == "success"){
// // 			$('#registerState').html('''注册成功去<a href="index.html">登录</a>''')
// // 		}
// 	})

// $('#loginForm').submit(function(){
// 	if(!$("#loginForm").form('validate'))
// 	{
// 		return;
// 	}else{
// 		alert("45")
// 		var state = ajaxPost("#loginForm", "/user/register")
// 		alert(state)
// 	}
// 	
// })
});
</script>
</body>
</html>
